import type { NoteForm, NoteQuery, NoteVO } from './model';

import type { ID, IDS, PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

/**
 * 查询笔记创作列表
 * @param params
 * @returns 笔记创作列表
 */
export function noteList(params?: NoteQuery) {
  return requestClient.get<PageResult<NoteVO>>('/ai/content/list', { params });
}

/**
 * 导出笔记创作列表
 * @param params
 * @returns 笔记创作列表
 */
export function noteExport(params?: NoteQuery) {
  return commonExport('/ai/note/export', params ?? {});
}

/**
 * 查询笔记创作详情
 * @param id id
 * @returns 笔记创作详情
 */
export function noteInfo(id: ID) {
  return requestClient.get<NoteVO>(`/ai/content/${id}`);
}

/**
 * 新增笔记创作
 * @param data
 * @returns void
 */
export function noteAdd(data: NoteForm) {
  return requestClient.postWithMsg<void>('/ai/note', data);
}

/**
 * 更新笔记创作
 * @param data
 * @returns void
 */
export function noteUpdate(data: NoteForm) {
  return requestClient.putWithMsg<void>('/ai/content', data);
}

/**
 * 删除笔记创作
 * @param id id
 * @returns void
 */
export function noteRemove(id: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/ai/note/${id}`);
}
